#include "video.h"
#include <QCamera>
#include <QCameraInfo>
#include <QDebug>
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QPushButton>

Video::Video(QWidget *parent) : QWidget(parent)
{

    camera = new QCamera(this);
    viewfinder=new QCameraViewfinder(this);
    imageCapture=new QCameraImageCapture(camera);
    camera->setViewfinder(viewfinder);
    viewfinder->setFixedSize(275,300);
    camera->start();

    connect(imageCapture, SIGNAL(imageCaptured(int,QImage)), this, SLOT(displayImage(int,QImage)));

}

void Video::captureImage()
{
    imageCapture->capture();
}

void Video::displayImage(int i , QImage image)
{
    emit sendImage(i,image);
}

void Video::saveImage()
{

}
